package com.ethan.blog.common.properties;

import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

@Data
@Component
@ConfigurationProperties(prefix = "jwt")
public class JwtProperties {

    /**
     * 用户生成jwt令牌相关配置
     */
//    @Value("${jwt.userSecretKey}")
    private String userSecretKey;
    //    @Value("${jwt.header}")
    private String header;
    //    @Value("${jwt.claimsName}")
    private String claimsName/* = "claims"*/;

    //    @Value("${jwt.expire-time.seconds}")
    private long seconds;
    //    @Value("${jwt.expire-time.minutes}")
    private long minutes;
    //    @Value("${jwt.expire-time.hours}")
    private long hours;
    //    @Value("${jwt.expire-time.days}")
    private long days;


    public long getExpireTime() {
        return days * 24L * 60 * 60 * 1000
                + hours * 60 * 60 * 1000
                + minutes * 60 * 1000
                + seconds * 1000;
    }
}
